<div class="container">
	<header data-am-widget="header" class="am-header am-header-default my-header">
		<div class="am-header-left am-header-nav">
			<a href="#/home2" class="">
				<i class="am-header-icon am-icon-chevron-left"></i>
			</a>
		</div>
		<h1 class="am-header-title">
        <a href="#title-link" class="">生成二维码</a></h1>
	</header>
<div>

	</div>
	
	<body>
    <p>内容：<input type="text" id="content" value="http://weibo.com/fdipzone" /></p>
    <p style="display: none;">尺寸：<input type="text" id="size" value="150"></p>
    <p><button id="send">生成二维码</button></p>
    <div id="qrcode"></div>
</body>
	
	<footer data-am-widget="footer" class="am-footer am-footer-default" data-am-footer="{  }">
		<hr data-am-widget="divider" style="" class="am-divider am-divider-default" />
		<div class="am-footer-miscs ">
			<p>CopyRight©2014 AllMobilize Inc.</p>
			<p>软件二班 张朝辉</p>
		</div>
	</footer>
	<!--底部-->
	<div data-am-widget="navbar" class="am-navbar am-cf my-nav-footer " id="">
		<ul class="am-navbar-nav am-cf am-avg-sm-4 my-footer-ul">
			<li>
				<a href="#/home" class="">
					<span class="am-icon-home"></span>
					<span class="am-navbar-label">首页</span>
				</a>
			</li>
			<li>
				<a href="#/shopmap" class="">
					<span class=" am-icon-map-marker"></span>
					<span class="am-navbar-label">地图</span>
				</a>
			</li>
			<li>
				<a href="#/information" class="">
					<span class="am-icon-user"></span>
					<span class="am-navbar-label">用户</span>
				</a>
			</li>
		</ul>
	</div>
</div>

<script type="text/javascript">
window.onload = function(){

    // 二维码对象
    var qrcode;

    // 默认设置
    var content;
    var size;

    // 设置点击事件
    document.getElementById("send").onclick =function(){
    	
    	alert("什么鬼");
        
        // 获取内容
        content = document.getElementById("content").value;
        content = content.replace(/(^\s*)|(\s*$)/g, "");

        // 获取尺寸
        size = document.getElementById("size").value;

        // 检查内容
        if(content==''){
            alert('请输入内容！');
            return false;
        }

        // 检查尺寸
        if(!/^[0-9]*[1-9][0-9]*$/.test(size)){
            alert('请输入正整数');
            return false;
        }

        if(size<100 || size>500){
            alert('尺寸范围在100～500');
            return false;
        }

        // 清除上一次的二维码
        if(qrcode){
            qrcode.clear();
        }

        // 创建二维码
        qrcode = new QRCode(document.getElementById("qrcode"), {
            width : size,//设置宽高
            height : size
        });

        qrcode.makeCode(document.getElementById("content").value);
    }

}
</script>